package com.demo.mq.activemq.service;

import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Service;

/**
 * 消息消费者
 *
 * @author lee9213@163.com
 * @version 1.0
 * @date 2017/3/13 18:11
 */
@Service
public class MQConsumerService {

    private String text;

//    @JmsListener(destination = "sample.queue")
//    public void receiveQueue(String text){
//        this.text = text;
//        System.out.println(text);
//    }

    @JmsListener(destination = "sample.topic")
    public void receiveTopic(String text){
        this.text = text;
        System.out.println(text);
    }


    public String receive(){
        return text;
    }
}
